<extend name="Base/common_nojhd"/>
<block name="TITLE"><title>商品详情</title></block>
<block name="style">
     <style>
        #spcontent img{
            width: 100%;
        }
    </style>
</block>
   
 
<block name="body">
    
<!--轮播图-->
<volist name="goodlist" id="good">
<div class="am-slider am-slider-default am-margin-0"  data-am-flexslider="{controlNav:false,directionNav: false, slideshow: true}" id="demo-slider-0">
    <ul class="am-slides">
        <volist name="imgarr" id="imgurl">
         <li><img src="{$imgurl}" /></li>
        </volist>
  </ul>
</div>

<div data-am-widget="titlebar" class="am-titlebar am-titlebar-default">
    <h2 class="am-titlebar-title " style="font-size: medium!important;">{$good.name}</h2>
  <h2 style="display: none;" class='goodId'>{$good.id}</h2>
</div>
<div class="am-g am-margin-left-sm am-margin-vertical-0">
    <div class="am-u-sm-4 am-text-xs" style="color:#2d3e50;text-align: center;"><span>{$good.num0}</span></div>
    <div class="am-u-sm-4 am-text-xs " style="color:#2d3e50;text-align: center;">{$good.num1}</div>
    <div class="am-u-sm-4 am-text-xs " style="color:#2d3e50;text-align: center;">{$good.num2}</div>
</div>
<div class="am-g am-margin-left-sm am-margin-vertical-0">
    <div class="am-u-sm-4 am-text-xl " style="color:#d83832">￥{$good.price}</div>
    <div class="am-u-sm-4 am-text-xl " style="color: red;">{$good.price1}</div>
    <div class="am-u-sm-4 am-text-xl " style="color: red;">{$good.price2}</div>
</div>
<div class="am-g am-margin-0 am-padding-sm" style='background-color:#F8F8F8 '>
  <div class="am-u-sm-6 ">
    <span class=" am-icon-truck">送货上门</span>
     <span class="am-icon-credit-card am-margin-top-xs " >货到付款</span>
  </div>
  <div class="am-u-sm-5">
      <span class="am-icon-clock-o">验货后付款</span>
      <span class="am-icon-calendar am-margin-top-xs" >节假日不休</span>
  </div>
</div>
<div class="am-container">
<table class="am-table am-table-bordered am-table-radius am-table-striped am-margin-top-sm">
    <tbody>
        <tr>
            <td>规格</td>
            <td>产地</td>
        </tr>
        <tr>
            <td>{$good.quantity}</td>
            <td>{$good.origin}</td>
        </tr>
          <tr>
            <td>摆放周期</td>
            <td>存储方式</td>
        </tr>
        <tr>
            <td>{$good.cycle}</td>
            <td>{$good.storage}</td>
        </tr>
    </tbody>
</table>
</div>
<div data-am-widget="titlebar" class="am-titlebar am-titlebar-default">
  <h2 class="am-titlebar-title ">商品详情</h2>
</div>
<div  id="spcontent" style="max-width:100%;">{$good.content}</div>
<div data-am-widget="titlebar" class="am-titlebar am-titlebar-default" style="display:none">
  <h2 class="am-titlebar-title ">世果承诺</h2>
</div>
<div  id="spcontent" style="max-width:100%;"><img src="http://7xk7h0.com1.z0.glb.clouddn.com/shiguocn.jpg" style="width: 100%"/></div>
 
</volist>
    <!-- 底部
   ================================================== -->
    <div data-am-widget="navbar" class="am-navbar am-cf  " id="" style="height: 49px !important;background: #FFF;">
        <ul class=" am-cf am-padding-0" style='font-size:1.1em;height: 49px !important;'>
            <li class="am-u-sm-6 am-padding-0" style="height: 49px!important;">
                <if condition="($good.inventory lt 0 )OR($good.inventory eq 0 )">
                    <button type="button" style="width: 100%;line-height: 49px !important;" class="am-margin-top-0 am-padding-vertical-0 am-btn am-btn-warning ">
                        &nbsp;正在补货&nbsp;
                    </button>
                    <else/>
                    <a style="width: 100%;line-height: 49px !important;" href="{:U('BuyNow/add',array('id'=>$good['id']))}">
                        <button class="am-margin-top-0 am-padding-vertical-0 am-btn " style="width: 100%;line-height: 49px!important;background: #F67300;color:#FFF;" >
                            立即购买
                        </button>
                    </a>

                </if>
            </li>
            <!--1：独立商品 2：非独立商品-->
                <switch name="good.independent">
                    <case value="1">
                        <li class="am-u-sm-6 am-padding-0" style="height: 49px !important;">
                            <button  type="button" style="width: 100%;line-height: 49px !important;" class="am-disabled am-margin-top-0 am-padding-vertical-0 am-btn am-btn-primary ">
                                加入购物车
                            </button>
                        </li>
                    </case>
                    <case value="2">
                        <li class="am-u-sm-6 am-padding-0" style="height: 49px !important;">
                            <if condition="($good.inventory lt 0 )OR($good.inventory eq 0 )">
                                <button  type="button" style="width: 100%;line-height: 49px !important;" class="am-disabled am-margin-top-0 am-padding-vertical-0 am-btn am-btn-primary btn-loading-example"
                                         data-am-loading="{spinner: 'circle-o-notch', loadingText: '搬货中...',resetText: '已加购物车',setText: '加入购物车'} ">
                                    加入购物车
                                </button>
                            <else/>
                                <if condition="($good.iscart eq true)">
                                    <button  type="button" style="width: 100%;line-height: 49px !important;" class="am-margin-top-0 am-padding-vertical-0 am-btn am-btn-secondary btn-loading-example am-active"
                                             data-am-loading="{spinner: 'circle-o-notch', loadingText: '搬货中...',resetText: '已加购物车',setText: '加入购物车'} ">
                                        已加购物车
                                    </button>
                                <else/>
                                    <button  type="button" style="width: 100%;line-height: 49px !important;" class="am-margin-top-0 am-padding-vertical-0 am-btn am-btn-primary btn-loading-example"
                                             data-am-loading="{spinner: 'circle-o-notch', loadingText: '搬货中...',resetText: '已加购物车',setText: '加入购物车'} ">
                                        加入购物车
                                    </button>
                                </if>
                            </if>
                        </li>
                    </case>
                </switch>
        </ul>
    </div>
 <include file="Public/var"/>

</block>
 <block name="script">
<script  type="text/javascript">
 $(function(){
    $('.btn-loading-example').click(function () {
        var $btn = $(this);
        var goodId=parseInt($('.goodId').text());      
        if($btn.hasClass('am-active')){
               $btn.button('loading');
               setTimeout(function(){
                   $btn.button('set');
                   $btn.removeClass("am-active");
//                   $btn.removeClass("am-btn-secondary am-active");
//                   $btn.addClass("am-btn-danger");
               }, 1000);
              $.post('__URL__/Productajax',{pid:goodId,actStatus:'del'},function(msg){

               });
        }else{
               $btn.button('loading');
               setTimeout(function(){
                   $btn.button('reset');
//                   $btn.removeClass("am-btn-danger");
//                   $btn.addClass("am-btn-secondary am-active");
                   $btn.addClass("am-active");
                },1000);
              $.post('__URL__/Productajax',{pid:goodId,actStatus:'add'},function(msg){

               });

        } 
  

    });
 });
</script>
</block>  